package cn.jy.ad.controller;

import cn.jy.ad.common.Result;
import cn.jy.ad.service.ZhipuAIService;
import cn.jy.common.ad.domain.AiDialogue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/zhipu")
public class ZhipuAIController {

    @Autowired
    private ZhipuAIService zhipuAIService;


    @PostMapping("/generate")
    public String generateResponse(@RequestBody String prompt) {
        return zhipuAIService.generateResponse(prompt);
    }
    @GetMapping("/list")
    public Result list() {
       List<AiDialogue> list = zhipuAIService.list();
        return Result.success(list);
    }
}